package com.blensmile.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import org.greenrobot.greendao.database.Database;

/**
 * Created by blensmile on 2017/6/29.
 */

public class TestOpenHelper extends DaoMaster.OpenHelper{

    public TestOpenHelper(Context context, String name) {
        super(context, name);
    }

    public TestOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory) {
        super(context, name, factory);
    }

     @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
         try {
             MigrationHelper.getInstance().migrate(db, UserDao.class);
         }catch (Exception e){
             DaoMaster.dropAllTables(db, true);
             onCreate(db);
         }
    }
}
